﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CCWin;


namespace InterfaceView
{
    public partial class rmAddroom : CCSkinMain
    {
        public rmAddroom()
        {
            InitializeComponent();
        }

        private void skinLabel1_Click(object sender, EventArgs e)
        {

        }

        private void skinButton1_add_Click(object sender, EventArgs e)
        {
            if(validateInput())
            {
                string roomId = this.skinTextBox1_id.Text;
                string roomType = this.skinComboBox1_type.SelectedItem.ToString();
                string roomPrice = this.skinTextBox3_price.Text;
                string roomStatus = "Empty";
                if(BusinessLogic.RM.AddRoom(roomId, roomType, roomPrice)!=null)
                {
                    MessageBox.Show("Room  have add to succeed !");
                    BusinessLogic.RM.AddintoRs(roomId, roomType, roomPrice, roomStatus);
                    this.Close();
                }
            }
        }

        public bool validateInput()
        {
            if(this.skinTextBox1_id.Text.Length == 0 || this.skinComboBox1_type.Text.Length == 0 ||this.skinTextBox3_price.Text.Length ==0)
            {
                MessageBox.Show("RoomID or Type or Price can not Empty ! ");
                this.skinTextBox1_id.Focus();
                return false;
            }
            return true;
        }

        private void skinButton2_cancle_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
